//引入样式
require('../../assets/css/normalize.css')
require('../../assets/css/reset.css')
require('../../assets/fonts/iconfont.css');
require('../../assets/css/tabbar.less')
require('../../assets/css/navbar.less')
require('./sports_ride.less')

//引入模块
const dom = require('../../utils/dom.js')
let axios = require('../../utils/axios.js')

document.addEventListener('DOMContentLoaded', function () {
    axios.get('/api/exercise').then(res => {
        console.log(res);
        //渲染总里程
        dom.get('.total').textContent = res.data.data.sum7Meter / 1000
    })

    //渲染底部导航
    dom.tabbar('sports');

    //渲染顶部导航
    dom.navbar('ride')

    //点击GO出现蒙层
    dom.get('.go').addEventListener('click', function () {
        dom.get('.mask').style.display = "block"
        let timer = null
        let n = 3
        timer = setInterval(function () {
            dom.get('.num').textContent = --n
            if (n === 0) {
                location = "./sports_ridding.html"
            }
        }, 1000)
    })

})
